using System;
using System.Collections.Generic;

using BLToolkit.DataAccess;

using EMan.Server.Interface.DAL;

namespace Server.FunctionalTests.Dal.Helpers
{
  public class TemporaryDatabase<T, TA> : TemporaryDatabase  where TA : DataAccessor, IDisposable, IDalc<T>
  {
    public bool Insert(T entity)
    {
      using( var dalc = GetDalc< TA >() )
        return dalc.Insert( entity );
    }

    public bool Update(T entity)
    {
      using( var dalc = GetDalc< TA >() )
        return dalc.Update( entity );
    }

    public T Get(int id)
    {
      using( var dalc = GetDalc< TA >() )
        return dalc.Get( id );
    }

    public IList<T> GetList()
    {
      using( var dalc = GetDalc< TA >() )
        return dalc.GetList( );
    }

    public bool Delete(int id)
    {
      using( var dalc = GetDalc< TA >() )
        return dalc.Delete( id );
    }
  }
}